#include <Windows.h>

/** caches the console handle, so the operating system context switch happens fewer times */
HANDLE consoleHandle = 0;

void setCursorPosition(int x, int y)
{
	COORD c = {x,y};
	if(!consoleHandle)
		consoleHandle = GetStdHandle(STD_OUTPUT_HANDLE);
	SetConsoleCursorPosition(consoleHandle, c);
}
void setColor(int c)
{
	if(!consoleHandle)
		consoleHandle = GetStdHandle(STD_OUTPUT_HANDLE);
	SetConsoleTextAttribute(consoleHandle, c);
}

